package com.xbs.service.hitchhiking;
/**
 * 前台顺风车订单管理
 */
import java.sql.Timestamp;

import com.xbs.dao.hitchhiking.HitchOrderDao;
import com.xbs.entity.HitchEntity;
import com.xbs.entity.OrderMoney;
import com.xbs.entity.StoreEntity;

public class HitchOrderService {
private  HitchOrderDao orderdao;
	
	public HitchOrderService() {
		orderdao = new HitchOrderDao();
		
	}
	
	/**
	 *1. 向普通订单表中填数据
	 */
	public int getHitchOrder(HitchEntity hitch,String uname,String uidcard,String uemail,String orderid,String costatus){
		
		String cartype = hitch.getCarmodelname();
		String raddress = hitch.getEnd_store_city();
		String gaddress = hitch.getStart_store_city();
		String orderkind = "顺风车";
		Double planmoney = Double.valueOf(hitch.getHitch_money());
		String gstore = hitch.getStart_store_name();
		String rstore = hitch.getEnd_store_name();	
		return orderdao.getOrder(orderid, uidcard, cartype, 
				raddress, gaddress, orderkind,planmoney,gstore,rstore,costatus);
	}
	
	/**
	 * 2.向时间表中添加数据
	 */
	public int getHitchTime(String gettime,String retturntime,String orderid,
			String paytime){
		/*String order =orderid;*/
		Timestamp getts = new Timestamp(System.currentTimeMillis());
		getts = Timestamp.valueOf(gettime);
		Timestamp returnts = new Timestamp(System.currentTimeMillis());
		returnts = Timestamp.valueOf(retturntime);
		/*String ptime = paytime;*/
		return orderdao.getOrderTime(orderid, getts, returnts, paytime);
	}
	
	/**
	 * 3.向实际租车人表中添加数据
	 * 
	 */
	public int getHitchRent(String user_idcard,String rent_name,
			String rent_idcard,String rent_telphone,String coid){
		return orderdao.getRent(user_idcard, rent_name, rent_idcard, rent_telphone, coid);
	}
	
	/**
	 * 4.向顺风车金钱表中添加一条数据
	 */
	public int getOrderMoney(OrderMoney om){
		return  orderdao.getMoney(om);
	}
}
